import React, { Component } from 'react'
import { Card } from 'antd'
import echarts from 'echarts/lib/echarts'
//导入饼图
import 'echarts/lib/chart/pie'
import 'echarts/lib/component/tooltip'
import 'echarts/lib/component/title'
import 'echarts/lib/component/legend'
import 'echarts/lib/component/markPoint'
import ReactEcharts from 'echarts-for-react'

export default class Hxt extends Component {
    // componentWillMount(){
    //     echarts.registerTheme("Imooc", echartTheme) //注入主题
    // }
    getOption = ()=>{
        let option = {
            title: {
                text: '',
                x: 'center'
            },
            tooltip : {
                trigger: 'item',
                //提示框浮层内容格式器，支持字符串模板和回调函数形式。
                formatter: "{a} <br/>{b} : {c} ({d}%)" 
            },
            legend: {
                orient: 'vertical',
                top: 20,
                right: 5,
                data: ['火灾隐患类型','火灾隐患区域']
            },
            series : [
                {
                    type:'pie',
                    data:[
                        {value:1000, name:'火灾隐患类型'},
                        {value:1500, name:'火灾隐患区域'}
                    ],
                }
            ]
        }
        return option;
    }
    render() {
        return (
            <Card.Grid className="pie_a">
                <ReactEcharts option={this.getOption()}/>
            </Card.Grid>
        )
    }
}